apiVersion: apps/v1
kind: Deployment
metadata:
  name: short-api-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      components: backend
  template:
    metadata:
      labels:
        components: backend
    spec:
      containers:
      - name: short-api
        image: antonlarichev/short-api:latest
        resources:
          limits:
            memory: "500Mi"
            cpu: "200m"
        ports:
          - containerPort: 3000
        env:
          - name: DATABASE_URL
            valueFrom:
              secretKeyRef:
                key: DATABASE_URL
                name: short-api-secret
        volumeMounts:
          - name: test
            mountPath: /etc/test
            readOnly: true
        livenessProbe:
          exec:
            command:
              - curl
              - --fail
              - http://localhost:3000/api
            initialDelaySeconds: 30
            periodSeconds: 5
            failureThreshold: 1
        readinessProbe:
            exec:
            command:
              - curl
              - --fail
              - http://localhost:3000/api
            initialDelaySeconds: 30
            periodSeconds: 5
            failureThreshold: 1
      volumes:
        - name: test
          configMap:
            name: demo-config